﻿using System;
using SharePointContentGenerator.ContentGeneratorLogic;

namespace SharePointContentGenerator.ContentGeneratorTestHarness
{
    class Program
    {
        static void Main(string[] args)
        {
            ContentGeneratorFacade facade = new ContentGeneratorFacade();
            facade.ContentGenerationStarted += facade_ContentGenerationStarted;
            facade.ContentGenerationFinished += facade_ContentGenerationFinished;
            facade.ContentGenerationChanging += facade_ContentGenerationChanging;

            // Creates a new word document
            //facade.CreateWordDocument("C:\\TEMP\\Test.docx");

            // Creates a document library
            facade.CreateDocumentLibraries("http://sms06107:82", "MyDocLibNew", 5, true, true, 1, 10);

            Console.WriteLine("Click any key to close...");
            Console.ReadLine();
        }

        static void facade_ContentGenerationChanging(object sender, ContentGeneratorLogic.Core.ContentGeneratorItemEventArgs e)
        {
            if (e.CurrentAction == ContentGeneratorLogic.Core.ContentGeneratorAction.Creating)
            {
                Console.WriteLine(string.Format("Creating document library {0} of {1} - {2} ", e.CurrentItemIndex + 1, e.TotalItems, e.ItemName));
            }
            else if (e.CurrentAction == ContentGeneratorLogic.Core.ContentGeneratorAction.Deleting)
            {
                Console.WriteLine(string.Format("Deleting document library {0}", e.ItemName));
            }
        }

        static void facade_ContentGenerationFinished(object sender, ContentGeneratorLogic.Core.ContentGeneratorItemEventArgs e)
        {
            Console.WriteLine("Content Generator Finished");
        }

        static void facade_ContentGenerationStarted(object sender, ContentGeneratorLogic.Core.ContentGeneratorItemEventArgs e)
        {
            Console.WriteLine(string.Format("Content Generator Started, creating {0} document libraries", e.TotalItems));
        }
    }
}
